package com.wyz.tracing.infrastructure.repository;

import com.wyz.tracing.domain.entity.base.Aggregate;
import com.wyz.tracing.domain.entity.base.Identifier;

import java.io.IOException;

/**
 * @author wyz
 * @version 1.0
 * @date 2023/8/14
 * <p>
 * 仓储接口
 */
public interface Repository<T extends Aggregate<ID>, ID extends Identifier> {

    /**
     * 保存
     *
     * @param aggregateRoot
     * @throws IllegalAccessException
     */
    void save(T aggregateRoot) throws IllegalAccessException, IOException, ClassNotFoundException;

    /**
     * 删除
     *
     * @param aggregateRoot
     */
    void remove(T aggregateRoot);

    /**
     * 查询
     *
     * @param identifier
     * @return
     */
    T find(ID identifier) throws IOException, ClassNotFoundException;
}
